package neo

import org.neo4j.ogm.annotation.Id
import org.neo4j.ogm.annotation.NodeEntity
import org.neo4j.ogm.annotation.Relationship

@NodeEntity
open class Actor {
  @Id lateinit var id: String
  lateinit var name: String

  @Relationship(type = "ACTS_IN", direction = Relationship.Direction.OUTGOING)
  val movies: MutableSet<Movie> = HashSet()

  fun actsIn(movie: Movie) {
    movies.add(movie)
    movie.actors.add(this)
  }
}
